///////////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2008  
// Authors: Aljosa Osep (aljosa.osep@gmail.com), Jernej Kranjec (jernej.kranjec@gmail.com)
// From Faculty of Electrical Engineering and Computer Science, Maribor, Slovenia
// Done at School of Technology, Seinajoki, Finland
// Under mentor Kimmo Salmenjoki (kimmo.salmenjoki@seamk.fi)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////////////////


using System;
using System.IO;
using System.Net;
using System.Reflection;

using CookComputing.XmlRpc;

//[XmlRpcUrl("http://localhost:8069/xmlrpc/common")] 

public interface ILogin : IXmlRpcProxy { 
	[XmlRpcMethod("login")] 
	int login(string dbName, string uName, string pwd);	
}

public interface IExecute : IXmlRpcProxy { 
	[XmlRpcMethod("execute")]
	
	int execute(string dbName, int uid, string pwd, string field, string action, XmlRpcStruct ddb);
}


class aTest {
	static void Main(string[] args) {
		
		ILogin proxy = XmlRpcProxyGen.Create<ILogin>();
		proxy.Url = "http://192.84.176.111:8069/xmlrpc/common";
		int uid = proxy.login("terp", "admin", "admin");
		
		IExecute proxy2 = XmlRpcProxyGen.Create<IExecute>();
		proxy2.Url = "http://192.84.176.111:8069/xmlrpc/object";
		
		XmlRpcStruct ddb = new XmlRpcStruct();
        ddb.Add("name", "Test");
        ddb.Add("description", "With Mono ...");

		proxy2.execute("terp", uid, "admin", "db_demo.ddb", "create", ddb);
	}
}
